package com.gd.data.platform.dto;

import java.time.LocalDateTime;
import java.util.List;

import lombok.Data;

/**
 * 实时监控数据DTO
 * 用于前端监控大屏展示
 * 
 * @author gd-data-platform
 * @since 1.0.0
 */
@Data
public class RealtimeMonitorData {

    /**
     * 总调用量
     */
    private Long totalCallCount;

    /**
     * 成功调用量
     */
    private Long successCallCount;

    /**
     * 失败调用量
     */
    private Long failureCallCount;

    /**
     * 失败率
     */
    private Double failureRate;

    /**
     * 平均响应时间（毫秒）
     */
    private Double avgResponseTime;

    /**
     * 当前在线用户数
     */
    private Integer onlineUserCount;

    /**
     * 数据更新时间
     */
    private LocalDateTime updateTime;

    /**
     * 接口调用排行
     */
    private List<ApiCallRanking> apiCallRankings;

    /**
     * IP访问排行
     */
    private List<IpAccessRanking> ipAccessRankings;

    /**
     * 告警信息
     */
    private List<AlertInfo> alerts;

    @Data
    public static class ApiCallRanking {
        private String apiName;
        private Long callCount;
        private Double successRate;
    }

    @Data
    public static class IpAccessRanking {
        private String clientIp;
        private Long accessCount;
        private Long downloadCount;
    }

    @Data
    public static class AlertInfo {
        private String alertType;
        private String alertMessage;
        private String alertLevel;
        private LocalDateTime alertTime;
    }
}
